#include<iostream>
#include <ctadef.h>
#include <adidef.h>
#include <swidef.h>
#include "nfxdef.h"
using namespace std;
int main()
{
    DWORD ret;
	CTAQUEUEHD qhd;
	CTAHD ctahd;
    // set up to get the board info
    ret = ctaCreateQueue( NULL, 0, &qhd );
    if (ret != SUCCESS)
    {
        if ( ret == CTAERR_DRIVER_OPEN_FAILED )
        {
            fprintf( stderr, "Driver open failed.  Have you started agmon?" );
            exit(-1);
        }
        //GetAndPrintError( NULL_CTAHD, ret, "ctaCreateQueue()" );
        exit( -1 );
    }

    ret = ctaCreateContext( qhd, 0, "smartswitch", &ctahd );
    if (ret != SUCCESS)
    {
        //GetAndPrintError( NULL_CTAHD, ret, "ctaCreateContext()" );
        //CleanupAndExit( qhd, ctahd );
    }
	
	DWORD number_of_pages;
	DWORD tracked_pages = 1;
	NFX_CHECK_STATUS *page_array = new NFX_CHECK_STATUS[tracked_pages];
	ret = nfxCheckTIFF (ctahd, "test.tif", &number_of_pages,tracked_pages, page_array);
	switch(ret)
	{
	case SUCCESS :
		cout<<"No bad lines were found"<<endl;
		break;
	case CTAERR_BAD_ARGUMENT :
		cout<<"Invalid function argument passed."<<endl;
		break;
	case CTAERR_INVALID_CTAHD :
		cout<<"The specified context handle is invalid."<<endl;
		break;
	case NFXERR_BAD_FILE_FORMAT :
		cout<<"The specified file is not in TIFF-F or TIFF-S format."<<endl;
		break;
	case NFXERR_CHECK_BAD_LINES :
		cout<<"The specified file has at least one bad line, but can still be transmitted with NaturalFax."<<endl;
		break;
	}
	return 0;
}